package sw6.digipecs.database;

import android.database.Cursor;
import android.database.sqlite.SQLiteCursorDriver;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQuery;
import android.database.sqlite.SQLiteDatabase.CursorFactory;

public class PictureIDCursor extends IDCursor {
	
	// TODO: Update all documentation
	
	public PictureIDCursor(SQLiteDatabase db, SQLiteCursorDriver driver,
			String editTable, SQLiteQuery query) {
		super(db, driver, editTable, query);
		
		mIndexID = getColumnIndexOrThrow(DBAdapter.DB_Picture_ID);
	}

	private static final String[] mColumns = { DBAdapter.DB_Picture_ID };

	private static class Factory implements CursorFactory {
		@Override
		public Cursor newCursor(SQLiteDatabase db,
				SQLiteCursorDriver masterQuery, String editTable,
				SQLiteQuery query) {
			return new PictureIDCursor(db, masterQuery, editTable, query);
		}
	}
	
	public static PictureIDCursor queryAll(SQLiteDatabase mDb) {
		return (PictureIDCursor) mDb.queryWithFactory(new Factory(), true, DBAdapter.DB_Picture, mColumns, null, null, null, null, null, null);
	}

}
